package com.springfactory;

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import com.springfactory.component.FirstComponent;
import com.springfactory.component.SecondComponent;
import com.springfactory.utility.BeanHolder;

@SpringBootApplication
@ComponentScan(basePackages = {
	"com.springfactory.utility"
})
public class SpringFactory {
	public static void main(String[] args) {
		SpringApplication springApplication = new SpringApplication(SpringFactory.class);
		springApplication.setBannerMode(Banner.Mode.OFF);
		springApplication.run(args);
		
		FirstComponent firstComponent = BeanHolder.getBean(FirstComponent.class);
		System.out.println(firstComponent.getName());
		
		SecondComponent secondComponent = BeanHolder.getBean(SecondComponent.class);
		System.out.println(secondComponent.getName());
	}
}
